home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_09_10 / 9n10032b < prev    next >
Text File  |  1991-08-12  |  528b  |  25 lines

  1.  
  2. #include <ctype.h>
  3.  
  4. int cistrcmp(const char *ps1, const char *ps2)
  5. {
  6.         char c1, c2;
  7.  
  8.         while (1) {
  9.                 c1 = toupper(*ps1);
  10.                 c2 = toupper(*ps2);
  11.  
  12.                 if (c1 < c2)
  13.                         return -1;
  14.                 else if (c1 > c2)
  15.                         return 1;
  16.                 else if (c1 == '\0')
  17.                         return 0;
  18.                 else {
  19.                         ++ps1;
  20.                         ++ps2;
  21.                 }
  22.         }
  23. }
  24.  
  25.